<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>SyntaxHighlighter Theme Tests</title>
	<script type="text/javascript" src="../../static/plugin/syntaxhighlighter/js/jquery-1.4.2.js"></script>
</head>

<body>

<div id="output">
	<select id="theme"></select>
</div>

<style>
body {
	background: white;
	font-family: Helvetica;
}

.test-wrap {
	width: 100%;
	height: 800px;
	overflow: auto;
	border: none;
}
</style>

<script id="sample" type="text/plain">
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>SyntaxHighlighter Theme Tests</title>
	</head>
	
	<body>
		&lt;script>
		/**
		 * Looks for a child or parent node which has specified classname.
		 * Equivalent to jQuery's $(container).find(".className")
		 * @param {Element} target Target element.
		 * @param {String} search Class name or node name to look for.
		 * @param {Boolean} reverse If set to true, will go up the node tree instead of down.
		 * @return {Element} Returns found child or parent element on null.
		 */
		function findElement(target, search, reverse /* optional */)
		{
			if (target == null)
				return null;
		
			var nodes			= reverse != true ? target.childNodes : [ target.parentNode ],
				propertyToFind	= { '#' : 'id', '.' : 'className' }[search.substr(0, 1)] || 'nodeName',
				expectedValue,
				found
				;
				
			// main return of the found node
			if ((target[propertyToFind] || '').indexOf(expectedValue) != -1)
				return target;
		
			return found;
		};
		&lt;/script>
		
	</body>
	</html>
</script>

<script type="text/javascript">
var themes = [
		['#fff', 'Default'],
		['#000', 'Django'],
		['#fff', 'Eclipse'],
		['#000', 'Emacs'],
		['#000', 'FadeToGrey'],
		['#000', 'MDUltra'],
		['#000', 'Midnight'],
		['#000', 'RDark']
	];
	
$(document).ready(function()
{

	var sample = $('#sample').text().replace(/</g, '&lt;');
	
	
	$.each(themes, function(index)
	{
		$('#theme').append("<option value='"+this[0]+"'>"+this[1]+"</option>")
	});
	var $iframe = $('<iframe class="test-wrap" src="about:blank" />');
	$('#output').append($iframe);
	
	
function render(){	
$iframe.ready(function()
{
	var doc = $iframe[0].contentDocument;
	//$iframe.css('background', background);

	doc.write(''
        + '<link type="text/css" rel="stylesheet" href="../../static/plugin/syntaxhighlighter/styles/shCore' + $('#theme option:selected').text() + '.css"/>'

		//+ '<scr' + 'ipt type="text/javascript" src="../../static/plugin/syntaxhighlighter/scripts/XRegExp.js"></scr' + 'ipt>'
		+ '<scr' + 'ipt type="text/javascript" src="../../static/plugin/syntaxhighlighter/scripts/shCore.js"></scr' + 'ipt>'
		+ '<scr' + 'ipt type="text/javascript" src="../../static/plugin/syntaxhighlighter/scripts/shBrushXml.js"></scr' + 'ipt>'
		+ '<scr' + 'ipt type="text/javascript" src="../../static/plugin/syntaxhighlighter/scripts/shBrushJScript.js"></scr' + 'ipt>'

		+ '<pre type="syntaxhighlighter" class="brush: js; html-script: true; highlight: [5, 20]" title="This is SyntaxHighlighter theme ' + $('#theme option:selected').text() + ' in action!">'
			+ sample
		+ '</pre>'
		+ '<scr' + 'ipt type="text/javascript">'
			+ 'SyntaxHighlighter.highlight();'
		+ '</scr' + 'ipt>'
		);
	doc.close();
	});
}
	render();
	$('#theme').live('change',function(){
		render();
	})
});
</script>

</body>
</html>
